ostree.git
11 years agoOstreeGpgVerifier: Take the signed data as a GBytes
Matthew Barnes [Mon, 16 Mar 2015 17:01:55 +0000 (13:01 -0400)]
OstreeGpgVerifier: Take the signed data as a GBytes

Similar to c2b01ad.  For some reason I was thinking the commit data
still needed to be written to disk prior to verifying, but it's just
another artifact of spawning gpgv2 (predates using GPGME).

Makes for a nice cleanup in fetch_metadata_to_verify_delta_superblock()
as well.

11 years agoOstreeGpgVerifier: Don't add trustdb.gpg to the keyring list
Matthew Barnes [Mon, 16 Mar 2015 13:54:24 +0000 (09:54 -0400)]
OstreeGpgVerifier: Don't add trustdb.gpg to the keyring list

In case someone like me is mucking around in $OSTREE_GPG_HOME and
accidentally creates a trust database there.

11 years agoostree-repo.c: fix typo
Giuseppe Scrivano [Mon, 16 Mar 2015 10:27:19 +0000 (11:27 +0100)]
ostree-repo.c: fix typo

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agorepo: Delete .commitmeta file on empty metadata
Matthew Barnes [Fri, 13 Mar 2015 01:17:34 +0000 (21:17 -0400)]
repo: Delete .commitmeta file on empty metadata

The API docs for ostree_repo_write_commit_detached_metadata() were
written as though it already behaved that way.

https://bugzilla.gnome.org/746123

11 years agobuild: Use both pkg-config and AM_PATH_GPGME
Colin Walters [Wed, 11 Mar 2015 19:58:42 +0000 (15:58 -0400)]
build: Use both pkg-config and AM_PATH_GPGME

Apparently OpenEmbeddeded only supports pkg-config (and includes
gpgme.pc in its content), and Fedora only has the latter.  So do both.

11 years agoconfigure.ac: Make gpgme a hard dependency
Matthew Barnes [Wed, 11 Mar 2015 15:34:59 +0000 (11:34 -0400)]
configure.ac: Make gpgme a hard dependency

In anticipation of API enhancements for GPG signature verification, which
would otherwise require a non-functional stub version were GPGME excluded.

GPGME is a pretty lightweight dependency, and the motivation to exclude
it is not clear.

11 years agoREADME.md: Note make check
Colin Walters [Wed, 11 Mar 2015 01:51:20 +0000 (21:51 -0400)]
README.md: Note make check

11 years agosysroot: Port some deployment reading code to fd-relative APIs
Colin Walters [Tue, 10 Mar 2015 13:07:59 +0000 (09:07 -0400)]
sysroot: Port some deployment reading code to fd-relative APIs

More low hanging fruit in the sysroot department.

11 years agodeployment: Add an API to get relative origin path
Colin Walters [Tue, 10 Mar 2015 13:07:12 +0000 (09:07 -0400)]
deployment: Add an API to get relative origin path

This will be used for fd-relative cleanups.

11 years agosysroot: Drop unnecessary new sysroot object
Colin Walters [Tue, 10 Mar 2015 12:41:04 +0000 (08:41 -0400)]
sysroot: Drop unnecessary new sysroot object

We're asserting that "/" is the same as our path, so we don't need to
make a new object.

11 years agoostree-prepare-root: log informational messages to stdout
Daniel Drake [Mon, 9 Mar 2015 18:20:18 +0000 (12:20 -0600)]
ostree-prepare-root: log informational messages to stdout

ostree-prepare-root was logging normal, informational messages
to stderr which the systemd unit points to the console.

To achieve silent boot, log these ordinary messages to stdout only.

11 years agoglnx: Update
Colin Walters [Tue, 10 Mar 2015 01:21:47 +0000 (21:21 -0400)]
glnx: Update

11 years agosysroot: Make origin parsing code fd-relative
Colin Walters [Thu, 5 Mar 2015 23:42:22 +0000 (18:42 -0500)]
sysroot: Make origin parsing code fd-relative

Just more API conversion.

11 years agosysroot: Read the bootloader configuration with fd-relative API
Colin Walters [Thu, 5 Mar 2015 02:33:25 +0000 (21:33 -0500)]
sysroot: Read the bootloader configuration with fd-relative API

Another piece of the conversion.

11 years agosysroot: Read some bootloader state with fd-relative API
Colin Walters [Thu, 5 Mar 2015 02:03:25 +0000 (21:03 -0500)]
sysroot: Read some bootloader state with fd-relative API

This is the start of migrating the deployment path to fd-relative
code.

11 years agotests: Add tests for test-ot-tool-util
Giuseppe Scrivano [Fri, 6 Mar 2015 11:54:53 +0000 (12:54 +0100)]
tests: Add tests for test-ot-tool-util

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agosrc: Drop unused argument "value" from ot_parse_boolean
Giuseppe Scrivano [Fri, 6 Mar 2015 11:53:43 +0000 (12:53 +0100)]
src: Drop unused argument "value" from ot_parse_boolean

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agosrc: Move ot-tool-util from ostree/ to libotutil/
Giuseppe Scrivano [Fri, 6 Mar 2015 11:21:07 +0000 (12:21 +0100)]
src: Move ot-tool-util from ostree/ to libotutil/

These utilities are not actually specific to the ostree commandline.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agolibotutil: remove ot-waitable-queue.
Giuseppe Scrivano [Fri, 6 Mar 2015 10:48:24 +0000 (11:48 +0100)]
libotutil: remove ot-waitable-queue.

The module is not not used anymore.  It can be restored from git if
needed again.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agotests: add test for test-ot-opt-utils.
Giuseppe Scrivano [Fri, 6 Mar 2015 10:38:13 +0000 (11:38 +0100)]
tests: add test for test-ot-opt-utils.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agokeyfile-utils: add tests
Giuseppe Scrivano [Thu, 5 Mar 2015 14:40:52 +0000 (15:40 +0100)]
keyfile-utils: add tests

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoot_keyfile_copy_group: return FALSE on invalid inputs
Giuseppe Scrivano [Thu, 5 Mar 2015 13:40:00 +0000 (14:40 +0100)]
ot_keyfile_copy_group: return FALSE on invalid inputs

The function returns a gboolean, replace g_return_if_fail with
g_return_val_if_fail.

Add similar checks to the other functions.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoostree-repo-refs: Drop unused function "parse_rev_file".
Giuseppe Scrivano [Thu, 5 Mar 2015 11:18:30 +0000 (12:18 +0100)]
ostree-repo-refs: Drop unused function "parse_rev_file".

If it will be needed in future, it can be retrieved from the git
history.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agosrc: drop some dead assignments
Giuseppe Scrivano [Thu, 5 Mar 2015 10:57:41 +0000 (11:57 +0100)]
src: drop some dead assignments

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoOstreeGpgVerifier: Take the signature as a GBytes
Matthew Barnes [Tue, 3 Mar 2015 19:15:27 +0000 (14:15 -0500)]
OstreeGpgVerifier: Take the signature as a GBytes

The signature data is in memory to begin with, so there's no need to
write it to disk only to immediately read it back.

Also, because the GPGME multi-keyring workaround is somewhat expensive
to setup and teardown, concatenate all signatures into a single GBytes
so _ostree_gpg_verifier_check_signature() is only called once.  We're
currently only looking for one valid signature anyway.

11 years agogpg: Rewrite OstreeGpgVerifier to use GPGME
Matthew Barnes [Mon, 2 Mar 2015 16:16:16 +0000 (11:16 -0500)]
gpg: Rewrite OstreeGpgVerifier to use GPGME

This sets the stage for more advanced signature management.

(Also, talking to GPG over pipes sucks.)

Previously we were spawning gpgv2 with a bunch of --keyring options
for /usr/share/ostree/trusted.gpg.d/ and whatever other keyring files
were explicitly added.  GPGME has no public API for multiple keyrings,
so we work around the issue by setting up a temp directory to serve as
a fake "home" directory for the crypto engine and then concatenate all
the keyring files into a single public keyring (pubring.gpg).

Unfortunately at present we do this on every signature verification.
There's a desire to cache this concatenation, but the problem is the
user may be unprivileged.  So it seems the cache would have to be per
user under $XDG_CACHE_HOME, which OSTree doesn't otherwise use.  I'm
open to suggestions.

We do at least clean up the temp directory when finished, and I have
further API changes planned to OstreeGpgVerifier to help mitigate the
performance impact.

11 years agotests: add tests for mutable tree.
Giuseppe Scrivano [Wed, 4 Mar 2015 13:14:18 +0000 (14:14 +0100)]
tests: add tests for mutable tree.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agorepo: Fix assertion to allow NULL options
Colin Walters [Wed, 4 Mar 2015 02:18:40 +0000 (21:18 -0500)]
repo: Fix assertion to allow NULL options

Spotted by Adam Coldrick.

11 years agocommit: Add missing (allow-none) in write_ref_immediate()
Colin Walters [Wed, 4 Mar 2015 02:16:33 +0000 (21:16 -0500)]
commit: Add missing (allow-none) in write_ref_immediate()

Spotted by Adam Coldrick.

11 years agodeltas: Use mmap() instead of copying input file
Colin Walters [Tue, 3 Mar 2015 23:39:45 +0000 (18:39 -0500)]
deltas: Use mmap() instead of copying input file

It's more efficient.

11 years agodeltas: Gather statistics on total number rollsum'd and bsdiff'd
Colin Walters [Tue, 3 Mar 2015 22:48:37 +0000 (17:48 -0500)]
deltas: Gather statistics on total number rollsum'd and bsdiff'd

Useful for debugging at least.  Though in the future it'd be nice to
store this inside the delta metadata maybe?

11 years agotests: Remove some duplications from Makefile-tests.am
Giuseppe Scrivano [Tue, 3 Mar 2015 13:21:40 +0000 (14:21 +0100)]
tests: Remove some duplications from Makefile-tests.am

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agotests: enforce ${CMD_PREFIX} on all ostree processes
Giuseppe Scrivano [Tue, 3 Mar 2015 12:13:54 +0000 (13:13 +0100)]
tests: enforce ${CMD_PREFIX} on all ostree processes

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoostree_repo_static_delta_generate: add new param "verbose"
Giuseppe Scrivano [Tue, 3 Mar 2015 10:59:09 +0000 (11:59 +0100)]
ostree_repo_static_delta_generate: add new param "verbose"

it will be used by the next patch that adds "--generate-static-delta"
to the commit command.

As part of the patch, update the list of supported "params" in the
documentation.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agostatic-delta: Add --disable-bsdiff option
Colin Walters [Mon, 2 Mar 2015 23:31:23 +0000 (18:31 -0500)]
static-delta: Add --disable-bsdiff option

A builder may not want to pay the CPU penalty.  Also it's useful for
evaluating performance.

11 years agoMakefile.dist-packaging: fix make rpm with submodules
Giuseppe Scrivano [Mon, 2 Mar 2015 10:39:51 +0000 (11:39 +0100)]
Makefile.dist-packaging: fix make rpm with submodules

Makefile.dist-packaging seems to assume to be run under packaging/ as
"make -C packaging -f Makefile.dist-packaging rpm" so ensure the
srcdir is set correctly to point to the parent directory.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoFix "make syntax-check" failures.
Giuseppe Scrivano [Mon, 23 Feb 2015 11:06:09 +0000 (12:06 +0100)]
Fix "make syntax-check" failures.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoautogen.sh: replace all $(libbsdiff_srcpath) and $(libglnx_srcpath)
Giuseppe Scrivano [Mon, 23 Feb 2015 10:57:02 +0000 (11:57 +0100)]
autogen.sh: replace all $(libbsdiff_srcpath) and $(libglnx_srcpath)

The variable could be specified more times on the same line, having
something like:

EXTRA_DIST += ./libglnx/README $(libglnx_srcpath)/COPYING

Now the change ensures that it looks like:

EXTRA_DIST += ./libglnx/README ./libglnx/COPYING

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agotests: add test for bsdiff
Giuseppe Scrivano [Mon, 23 Feb 2015 09:05:19 +0000 (10:05 +0100)]
tests: add test for bsdiff

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agostatic-delta: increase threshold for rollsum to 50%
Giuseppe Scrivano [Tue, 24 Feb 2015 11:16:46 +0000 (12:16 +0100)]
static-delta: increase threshold for rollsum to 50%

It favours bsdiff usage for files that are not very rollsum friendly.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoAdd bsdiff support to deltas
Giuseppe Scrivano [Mon, 23 Feb 2015 09:35:17 +0000 (10:35 +0100)]
Add bsdiff support to deltas

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoAdd bsdiff submodule
Giuseppe Scrivano [Thu, 12 Feb 2015 15:24:50 +0000 (16:24 +0100)]
Add bsdiff submodule

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agorepo: Port hardlink-scanning code to fd-relative calls
Colin Walters [Tue, 3 Mar 2015 14:13:47 +0000 (09:13 -0500)]
repo: Port hardlink-scanning code to fd-relative calls

Continuing the migration.

11 years agorepo: Drop internal GFile* API helper
Colin Walters [Tue, 3 Mar 2015 13:19:20 +0000 (08:19 -0500)]
repo: Drop internal GFile* API helper

There are no users anymore.

11 years agodeploy: Use glnx file copy code
Colin Walters [Thu, 26 Feb 2015 13:50:59 +0000 (08:50 -0500)]
deploy: Use glnx file copy code

This is centralizing more generic utility code in libglnx.

11 years agocore: Fix duplication bug in _ostree_detached_metadata_append_gpg_sig()
Matthew Barnes [Mon, 2 Mar 2015 19:43:41 +0000 (14:43 -0500)]
core: Fix duplication bug in _ostree_detached_metadata_append_gpg_sig()

g_variant_builder_add() does not replace identical keys in a VARDICT
variant, so signing a commit multiple times results in multiple copies
of "ostree.gpgsigs" in the metadata.  And since g_variant_lookup_value()
stops on the first match, subsequent signatures have no net effect.

Instead of GVariantBuilder use GVariantDict, which behaves more like a
hash table.

11 years agocore: Add definitions for GPG signature metadata
Matthew Barnes [Mon, 2 Mar 2015 19:30:52 +0000 (14:30 -0500)]
core: Add definitions for GPG signature metadata

_OSTREE_METADATA_GPGSIGS_NAME
_OSTREE_METADATA_GPGSIGS_TYPE

11 years agolibotutil: Allow no variant in ot_util_variant_builder_from_variant()
Matthew Barnes [Mon, 2 Mar 2015 19:55:01 +0000 (14:55 -0500)]
libotutil: Allow no variant in ot_util_variant_builder_from_variant()

For programming convenience in cases where we may or may not have a
GVariant to initialize the builder with.

11 years agolibotutil: Remove ot_variant_new_from_bytes()
Matthew Barnes [Mon, 2 Mar 2015 20:11:16 +0000 (15:11 -0500)]
libotutil: Remove ot_variant_new_from_bytes()

Not needed anymore - use g_variant_new_from_bytes().

11 years agoconfigure.ac: Bump GLib requirement to 2.40
Matthew Barnes [Mon, 2 Mar 2015 19:05:16 +0000 (14:05 -0500)]
configure.ac: Bump GLib requirement to 2.40

Mainly for GVariantDict, useful for metadata.

11 years agogpg: Remove _ostree_gpg_verifier_set_homedir()
Matthew Barnes [Fri, 27 Feb 2015 18:34:17 +0000 (13:34 -0500)]
gpg: Remove _ostree_gpg_verifier_set_homedir()

Never called, and the setting is never applied anyway.

11 years agoostree: Add gpg-sign command
Matthew Barnes [Wed, 25 Feb 2015 18:55:14 +0000 (13:55 -0500)]
ostree: Add gpg-sign command

Signs a commit with one or more GPG keys.

11 years agorepo: detached sigs: Use error prefixing instead of overwriting
Colin Walters [Tue, 24 Feb 2015 18:39:22 +0000 (13:39 -0500)]
repo: detached sigs: Use error prefixing instead of overwriting

Noted when "rpm-ostree compose sign" failed to write to a repo due to
permissions.

11 years agoprepare-root: Move /sysroot instead of unmounting it
Colin Walters [Fri, 13 Feb 2015 02:01:23 +0000 (21:01 -0500)]
prepare-root: Move /sysroot instead of unmounting it

I originally thought this would fix a regression, but it turns out
this wasn't the bug.  But pushing anyways as it's just cleaner.

https://bugzilla.gnome.org/show_bug.cgi?id=743891

11 years agobuild: build libbupsplit separately
Giuseppe Scrivano [Mon, 23 Feb 2015 11:44:47 +0000 (12:44 +0100)]
build: build libbupsplit separately

It avoids gobject-introspection warnings:

src/libostree/bupsplit.h:42: Warning: OSTree: symbol='bupsplit_find_ofs': Unknown namespace for symbol 'bupsplit_find_ofs'
src/libostree/bupsplit.h:43: Warning: OSTree: symbol='bupsplit_selftest': Unknown namespace for symbol 'bupsplit_selftest'
src/libostree/bupsplit.h:33: Warning: OSTree: symbol='BUP_BLOBBITS': Unknown namespace for symbol 'BUP_BLOBBITS'
src/libostree/bupsplit.h:34: Warning: OSTree: symbol='BUP_BLOBSIZE': Unknown namespace for symbol 'BUP_BLOBSIZE'
src/libostree/bupsplit.h:35: Warning: OSTree: symbol='BUP_WINDOWBITS': Unknown namespace for symbol 'BUP_WINDOWBITS'
src/libostree/bupsplit.h:36: Warning: OSTree: symbol='BUP_WINDOWSIZE': Unknown namespace for symbol 'BUP_WINDOWSIZE'

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoostree-repo-static-delta-processing: initialize "modev"
Giuseppe Scrivano [Mon, 23 Feb 2015 10:51:48 +0000 (11:51 +0100)]
ostree-repo-static-delta-processing: initialize "modev"

Can be gs_unref_variant'ed on an early error.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoFix GObject introspection annotation
Giuseppe Scrivano [Mon, 23 Feb 2015 10:18:05 +0000 (11:18 +0100)]
Fix GObject introspection annotation

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoostree-repo-traverse.c: Fix documentation parameter name
Giuseppe Scrivano [Mon, 23 Feb 2015 11:47:47 +0000 (12:47 +0100)]
ostree-repo-traverse.c: Fix documentation parameter name

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agotests: Move test gpg keyring into writable tmpdir
Colin Walters [Mon, 23 Feb 2015 18:02:37 +0000 (13:02 -0500)]
tests: Move test gpg keyring into writable tmpdir

At least the version of gpgme in RHEL7 wants to create a lock file,
work around this by copying it into the writable test temporary
directory.

11 years agoAdd explicit zlib dependency
Matthew Barnes [Mon, 23 Feb 2015 19:47:56 +0000 (14:47 -0500)]
Add explicit zlib dependency

Needed for CRC32 computations.

11 years agorepo: Port APIs used by prune to fd-relative *at calls
Colin Walters [Fri, 20 Feb 2015 21:09:22 +0000 (16:09 -0500)]
repo: Port APIs used by prune to fd-relative *at calls

More of the general trend away from GFile * to the faster and more
secure world of *at().

11 years agolibglnx: Use git.gnome.org's copy
Colin Walters [Mon, 23 Feb 2015 03:30:53 +0000 (22:30 -0500)]
libglnx: Use git.gnome.org's copy

Not the master from my laptop.

11 years agocheckout: Drop internal use of GFile *
Colin Walters [Fri, 20 Feb 2015 21:36:02 +0000 (16:36 -0500)]
checkout: Drop internal use of GFile *

Checkout was one of the first complex code paths I tried to convert to
*at().  I ended up keeping both, because I hit the "xattrs for a
symlink" problem.  Later, Florian gave me a workaround, and we started
using it here, but the GFile * parameters weren't deleted.  They're
not used, so do so now.

11 years agodeploy: Also look for /usr/lib/os-release
Colin Walters [Fri, 13 Feb 2015 02:35:19 +0000 (21:35 -0500)]
deploy: Also look for /usr/lib/os-release

With newer versions of systemd, the file has moved there.

11 years agoUse libglnx
Colin Walters [Tue, 17 Feb 2015 22:38:36 +0000 (17:38 -0500)]
Use libglnx

Starting down the path of not using libgsystem.  The main win here
will be code sharing between ostree/rpm-ostree as well as going down
the path of not using GFile * for local files.

11 years agotests: do not run tests/test-rollsum as part of make check
Giuseppe Scrivano [Fri, 13 Feb 2015 10:50:37 +0000 (11:50 +0100)]
tests: do not run tests/test-rollsum as part of make check

it is not really a unit test.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Conflicts:
Makefile-tests.am

11 years agorepo: Check for OSTREE_REPO in ostree_repo_new_default()
Matthew Barnes [Thu, 19 Feb 2015 15:30:25 +0000 (10:30 -0500)]
repo: Check for OSTREE_REPO in ostree_repo_new_default()

Convenience feature to avoid having to pass --repo options repeatedly.

Before falling back to the default system repository path, check for a
repository path defined by the OSTREE_REPO environment variable.

11 years agolibostree: set directory mtimes to 0 on checkout
Daniel Drake [Wed, 18 Feb 2015 23:18:21 +0000 (17:18 -0600)]
libostree: set directory mtimes to 0 on checkout

We already set all file mtimes to 0 so that they are constant
over all checkouts, and can be made constant with a known value from
the system where the ostree was created.

However, this was not happening for directories. Zero their mtimes too.

This is important for shipping a fontconfig cache in the ostree;
the fontconfig cache files embed a directory mtime.

11 years agotests: Restore accidentally deleted Makefile bit
Colin Walters [Mon, 16 Feb 2015 15:29:14 +0000 (10:29 -0500)]
tests: Restore accidentally deleted Makefile bit

Not sure how this got deleted...

11 years agodeltas: Search for similar objects (possibly renamed across directories)
Colin Walters [Wed, 11 Feb 2015 08:29:14 +0000 (03:29 -0500)]
deltas: Search for similar objects (possibly renamed across directories)

The previous diff algorithm was file tree based, and only looked
at modified files that lived at the same path.

However, components like the Linux kernel have versioned
subdirectories, e.g. /usr/lib/modules/$kver/.../ext4.ko.  We want to
be able to detect these "modified renames" so that we can compute
diffs (rollsum, bsdiff).

11 years agorepo: Add a new iterator traversal API for commits
Colin Walters [Wed, 11 Feb 2015 08:25:17 +0000 (03:25 -0500)]
repo: Add a new iterator traversal API for commits

This is a more optimized version of the GFile * APIs, and is now used
internally by the previous ostree_repo_traverse().

11 years agodeltas: Prune deltas when the corresponding "to" commit vanishes
Colin Walters [Mon, 2 Feb 2015 18:04:52 +0000 (13:04 -0500)]
deltas: Prune deltas when the corresponding "to" commit vanishes

We want prune to actually give you back disk space when using deltas.

11 years agodeltas: Make syntax-check happy
Colin Walters [Sat, 31 Jan 2015 19:52:16 +0000 (14:52 -0500)]
deltas: Make syntax-check happy

11 years agodeltas: Implement rollsums
Colin Walters [Fri, 30 Jan 2015 15:13:07 +0000 (10:13 -0500)]
deltas: Implement rollsums

This does an rsync-style prepared delta basically.  On my test data,
it shaves ~6MB of uncompressed data.  Not a huge amount, but I expect
this to be more useful for things like binaries which embed data, etc.

11 years agodeltas: Initial code to copy content from existing objects
Colin Walters [Fri, 30 Jan 2015 04:00:51 +0000 (23:00 -0500)]
deltas: Initial code to copy content from existing objects

This is preparatory work for implementing rollsum support.

11 years agodeltas: Flesh out the open/write/close opcodes
Colin Walters [Fri, 30 Jan 2015 03:32:44 +0000 (22:32 -0500)]
deltas: Flesh out the open/write/close opcodes

Refactor open-splice-and-close to call open/close.  We can't just call
write as that would require duplicating the object size parameter.

11 years agodeltas: Use the new internal streaming APIs
Colin Walters [Fri, 6 Feb 2015 02:35:01 +0000 (21:35 -0500)]
deltas: Use the new internal streaming APIs

This is significantly more efficient.

11 years agodeltas: Stub out a few more opcodes
Colin Walters [Thu, 29 Jan 2015 22:54:59 +0000 (17:54 -0500)]
deltas: Stub out a few more opcodes

11 years agodeltas: Print total size of rollsums we would use
Colin Walters [Thu, 29 Jan 2015 22:54:41 +0000 (17:54 -0500)]
deltas: Print total size of rollsums we would use

11 years agodeltas: Compute rollsum targets
Colin Walters [Thu, 29 Jan 2015 22:39:34 +0000 (17:39 -0500)]
deltas: Compute rollsum targets

11 years agodeltas: Rework format to allow streaming
Colin Walters [Thu, 29 Jan 2015 06:03:55 +0000 (01:03 -0500)]
deltas: Rework format to allow streaming

There's still some silliness here, but there is now only one opcode
open-splice-and-close, that writes a single chunk from the payload.
This is really all we need for metadata, and small content objects are
also fine with this.

We get some deduplication between content objects by creating a
dictionary for (uid,gid,mode) tuples and xattrs.

This still keeps the operation/payload code in, so we could do
rollsums in a future update easily.

11 years agodeltas: Add _V0 to part #define
Colin Walters [Wed, 28 Jan 2015 22:42:59 +0000 (17:42 -0500)]
deltas: Add _V0 to part #define

To make more explicitly clear that this is the version that matches
the version in the metadata.

11 years agodeltas: Remove support for gzipped delta parts
Colin Walters [Wed, 28 Jan 2015 22:24:11 +0000 (17:24 -0500)]
deltas: Remove support for gzipped delta parts

XZ is really, really good.

11 years agodeltas: Use base64 for csums, add version to parts
Colin Walters [Mon, 26 Jan 2015 04:51:41 +0000 (23:51 -0500)]
deltas: Use base64 for csums, add version to parts

11 years agorepo: Store pending objects in prefixed subdirectory
Colin Walters [Sun, 15 Feb 2015 20:30:19 +0000 (15:30 -0500)]
repo: Store pending objects in prefixed subdirectory

I was hitting a bug in libguestfs/guestmount/FUSE where it blew up
with EINVAL on directories containing lots of files (more than
32000?).  We really want to use prefixed subdirs just like the real
objects/ directory does.

This allows us to share more code between the paths, is more
efficient, etc.

11 years agorepo: Fix major performance regression with --scan-hardlinks
Colin Walters [Fri, 13 Feb 2015 21:34:52 +0000 (16:34 -0500)]
repo: Fix major performance regression with --scan-hardlinks

gnome-continuous uses the ostree_repo_scan_hardlinks() mode to
avoid re-checksumming everything.  However, when I ported the commit
code to use openat() and friends, this optimization was lost.

Re add it.  The difference is about 15s versus 5 minutes.

11 years agopull-local: Fix regression with absolute paths
Colin Walters [Fri, 13 Feb 2015 16:39:02 +0000 (11:39 -0500)]
pull-local: Fix regression with absolute paths

Don't add cwd unless the path is relative.

11 years agoChange pull-local to just be a wrapper for pull with file:///
Colin Walters [Sun, 8 Feb 2015 09:30:52 +0000 (04:30 -0500)]
Change pull-local to just be a wrapper for pull with file:///

This follows up from the previous commit; now that pull knows how to
do the efficient link() or copy for local files, we can just have
pull-local call into ostree_repo_pull().

As part of this:
 - pull() can also accept a file:/// URI instead
   of a remote name (since pull local supports anonymous pulls)
 - pull() knows an "override-remote-name" option, since pull-local
   supported writing a ref out even if there wasn't a remote with
   that name

11 years agopull: Optimize file:/// URIs to skip libsoup and hardlink if possible
Colin Walters [Fri, 6 Feb 2015 15:02:57 +0000 (10:02 -0500)]
pull: Optimize file:/// URIs to skip libsoup and hardlink if possible

It's always been suboptimal to have both pull and pull-local; as we go
beyond the raw object data into things like deltas and summary files,
the logic to perform e.g. mirroring should only be in one place.

This will be used by Pulp's OSTree content plugin at least to perform
promotions.

11 years agoAdd an internal API to get a read fd for a content object
Colin Walters [Fri, 6 Feb 2015 02:49:49 +0000 (21:49 -0500)]
Add an internal API to get a read fd for a content object

This will be used by the static deltas work.

11 years agopull: Copy the upstream summary file when doing a pull --mirror
Colin Walters [Wed, 4 Feb 2015 19:49:22 +0000 (14:49 -0500)]
pull: Copy the upstream summary file when doing a pull --mirror

While it could be regenerated downstream, there might be other
metadata upstream, and the goal here is a mirror.

https://bugzilla.gnome.org/show_bug.cgi?id=739377

11 years agoWhen mirroring, write content directly, do not verify
Colin Walters [Sun, 1 Feb 2015 16:09:47 +0000 (11:09 -0500)]
When mirroring, write content directly, do not verify

When doing a pull --mirror from an archive-z2 repository into another
archive-z2 repository, currently we gunzip/checksum/gzip each content
object.  The re-gzip process in particular is fairly expensive.

This does assume that the upstream content is trusted and correct.
It'd be nice in the future to do at least a CRC check, if not the full
checksum.  (Could we append CRC data to the end of filez objects?)

We could also choose to only do this optimization if fetching over
TLS.

before: 1626 metadata, 20320 content objects fetched; 299634 KiB transferred in 62 seconds
after : 1626 metadata, 20320 content objects fetched; 299634 KiB transferred in 11 seconds

11 years agoAdd an internal API to stream content objects
Colin Walters [Fri, 30 Jan 2015 02:23:05 +0000 (21:23 -0500)]
Add an internal API to stream content objects

For future delta work where we do more interesting things than just
"tar of new objects", this lays the groundwork for doing streaming
writes into content objects.

It's also more efficient, as we avoid many intermediate allocations
and virtual calls.  Just a single `g_output_stream_write_all` for the
splice case.

Conflicts:
src/libostree/ostree-repo-private.h
src/libostree/ostree-repo-static-delta-processing.c

11 years agoutil: Add an API to atomic-replace a file, dirfd relative, optional fsync
Colin Walters [Wed, 4 Feb 2015 19:45:09 +0000 (14:45 -0500)]
util: Add an API to atomic-replace a file, dirfd relative, optional fsync

This can be used in other places too, but I plan to use it to write
the summary file.

11 years agorepo: Hold an fd "repo_dir_fd" open for the toplevel too
Colin Walters [Mon, 2 Feb 2015 19:56:39 +0000 (14:56 -0500)]
repo: Hold an fd "repo_dir_fd" open for the toplevel too

We could just make everything relative to this, but the objects/ and
tmp/ are accessed very often, so I think it's worth holding individual
fds.

This fd can cover everything else: refs, deltas, etc.

11 years agoprepare-root: Update comments
Colin Walters [Wed, 4 Feb 2015 10:32:45 +0000 (05:32 -0500)]
prepare-root: Update comments

11 years agoprepare-root: avoid double-stacked /sysroot mount
Daniel Drake [Mon, 2 Feb 2015 21:12:47 +0000 (15:12 -0600)]
prepare-root: avoid double-stacked /sysroot mount

prepare-root works with the mount that has been set up at /sysroot.
It creates a bind-mount within /sysroot (the deployment) and then moves
that mount to /sysroot.

Now we have 2 mounts both at /sysroot, and once we do switch_root, we will
never be able to unmount both of them. I'm not sure if this is ultimately
a kernel bug, but either way, ostree could do a bit more tidying up
after itself.
http://thread.gmane.org/gmane.linux.file-systems/92411

Easy way to reproduce:
1. Boot with rd.break param
2. At initramfs shell, run: ostree-prepare-root /sysroot
3. Observe two /sysroot mounts in /proc/mounts

Fix this by setting up the mounts at /sysroot.tmp, and unmounting the
original /sysroot before our new mount is MS_MOVEd on top of it.

11 years agopackaging: Add man5 pages
Colin Walters [Wed, 4 Feb 2015 01:28:18 +0000 (20:28 -0500)]
packaging: Add man5 pages

11 years agotests: Add tests for ot-unix-utils
Giuseppe Scrivano [Mon, 2 Feb 2015 12:37:48 +0000 (13:37 +0100)]
tests: Add tests for ot-unix-utils

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agoconfigure.ac: Enable option subdir-objects for automake
Giuseppe Scrivano [Mon, 2 Feb 2015 12:00:32 +0000 (13:00 +0100)]
configure.ac: Enable option subdir-objects for automake

It silences an automake warning and keep the rootdir cleaner.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>